package school;

public class Course {
    private String id;
    private String name;
    private String location;
    private String time;
    private Teacher teacher;

    public Course(String id, String name, String location, String time) {
        this.id = id;
        this.name = name;
        this.location = location;
        this.time = time;
    }

    public void setTeacher(Teacher teacher) {
        this.teacher = teacher;
    }

    public Teacher getTeacher() {
        return teacher;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getLocation() {
        return location;
    }

    public String getTime() {
        return time;
    }

    @Override
    public String toString() {
        return "课程编号：" + id + "，名称：" + name + "，上课地点：" + location + "，时间：" + time + "，授课教师：" + (teacher != null? teacher.getName() : "无");
    }
}
